import Vue from 'vue';
import Router from 'vue-router';
import factory from '@/components/async-component/factory';

Vue.use(Router);
const routes = [
    {
        name: 'example1',
        path: '/example1',
        components: {
            default: factory('view/example1/index.vue'),
            bottom: factory('view/footer/index.vue')
        }
    },
    {
        name: 'Home',
        path: '/',
        component: factory('view/index/index.vue')
    },
    {
        name: 'example',
        path: '/example',
        component: factory('view/example/index.vue')
    }
];

export function createRouter () {
    return new Router({
        mode: 'history',
        routes
    });
}